package com.woniu.controller;

import com.woniu.dto.ProcessAdmissionDTO;
import com.woniu.service.AdmissionService;
import com.woniu.utils.ResponseUtil;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/api/admission")
public class AdmissionController {

    @Resource
    private AdmissionService admissionService;

    /**
     * API 1: 加载医生和床位资源
     */
    @GetMapping("/resources/{departmentId}")
    public ResponseUtil getResources(@PathVariable Integer departmentId) {
        return admissionService.getAdmissionResources(departmentId);
    }

    /**
     * API 2: 提交办理入院
     */
    @PostMapping("/process")
    public ResponseUtil process(@RequestBody ProcessAdmissionDTO dto) {
        // (Service 层已包含 try-catch)
        return admissionService.processAdmission(dto);
    }
}
